<template>
	<view class="report-page">
		<up-subsection :list="list" :current="0"></up-subsection>
		<view class="report-list-item" @click="goNextPage(item.statusType)" v-for="(item,index) in reportList" :key="index">
			<view class="report-list-item-deviceName">
				{{item.deviceName}}
			</view>
			<view class="report-list-item-desc">
				故障描述:
				<text class="text-padding"> {{item.desc}}</text>
			</view>
			<view class="report-list-item-address">
				地址:
				<text class="text-padding">{{item.address}}</text>
			</view>
			<view class="report-list-item-foot">
				报修时间:<text class="text-padding">{{item.createTime}}</text>|报修人:<text
					class="text-padding">{{item.creator}} </text>电话:<text>{{item.mobile}}</text>
			</view>
			<view class="report-list-item-status" v-if="item.status== '处理中'" style="background:#4285F4">
				{{item.status}}
			</view>
			<view class="report-list-item-status" v-if="item.status== '已完成'" style="background:#34A853">
				{{item.status}}
			</view>
			<view class="report-list-item-status" v-if="item.status== '评价'" style="background:#B8741A">
				{{item.status}}
			</view>
			<view class="report-list-item-status" v-if="item.status== '待处理'" style="background:#FBBC05">
				{{item.status}}
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from "vue"
	const list = ref(['待处理', '处理中', '待评价', '已完成']);
	const reportList = ref([{
			deviceName: "卫生间温控器",
			desc: " 温控器无法开机，面板不亮",
			address: "  辽宁省沈阳市沈北新区鑫源集团888号",
			createTime: "2025-6-5 14:30",
			creator: "张三",
			mobile: "13204043353",
			status: "处理中",
			statusType:1,	//新加处理状态 0:待处理,1:处理中,2:已完成,3:评价
		},
		{
			deviceName: "卫生间温控器",
			desc: " 温控器无法开机，面板不亮 温控器无法开机，面板不亮",
			address: "  辽宁省沈阳市沈北新区鑫源集团888号",
			createTime: "2025-6-5 14:30",
			creator: "张三",
			mobile: "13204043353",
			status: "已完成",
			statusType:2,	//新加处理状态
		},
		{
			deviceName: "卫生间温控器",
			desc: " 温控器无法开机，面板不亮",
			address: "  辽宁省沈阳市沈北新区鑫源集团888号",
			createTime: "2025-6-5 14:30",
			creator: "张三",
			mobile: "13204043353",
			status: "评价",
			statusType:3,	//新加处理状态
		},
		{
			deviceName: "卫生间温控器",
			desc: " 温控器无法开机，面板不亮 温控器无法开机，面板不亮 温控器无法开机，面板不亮",
			address: "  辽宁省沈阳市沈北新区鑫源集团888号",
			createTime: "2025-6-5 14:30",
			creator: "张三",
			mobile: "13204043353",
			status: "待处理",
			statusType:0,	//新加处理状态
		},
	])
	
	// 跳转页面
	const goNextPage = (statusType) => {
		if(statusType == 3) {
			// 跳转评价
			uni.navigateTo({
				url:'/Me/ReportEvaluate/ReportEvaluate?statusType='+statusType
			})
		}else{
			// 跳转报修详情
			uni.navigateTo({
				url:'/Me/ReportDetail/ReportDetail?statusType='+statusType
			})
		}
	}
</script>

<style lang="scss" scoped>
	.report-page {}

	.report-list-item {
		position: relative;
		padding: 10rpx 20rpx;
		border-radius: 10px;
		background: #f2f2f2;
		margin: 25rpx 40rpx;
	}

	.report-list-item-deviceName {
		color: #3c9cff;
		font-size: 28rpx;
		line-height: 50rpx;
		font-weight: 550;
	}

	.report-list-item-status {
		position: absolute;
		right: 15rpx;
		top: 10rpx;
		color: #fff;
		width: 120rpx;
		font-size: 24rpx;
		border-radius: 5px;
		line-height: 50rpx;
		text-align: center;
	}

	.report-list-item-desc,
	.report-list-item-address {
		width: 100%;
		word-wrap: break-word;
		margin: 10rpx 0;
		font-size: 24rpx;
	}

	.report-list-item-foot {
		color: #797979;
		font-size: 22rpx;
		margin-bottom: 10rpx;
	}

	.text-padding {
		padding: 0 10rpx;
	}
</style>